package outputviewer;
import guiobjects.IPaintedObject;

import java.awt.*;
import javax.swing.*;


import java.util.ArrayList;


/**
 * Creates an applet that be viewed over the web.
 *
 * @author Robert C. Duvall
 */
@SuppressWarnings("serial")
public class Applet extends JApplet
{
    public static final int DEFAULT_DELAY = 1000 / 5;  // in milliseconds

    private Canvas myDisplay;


    /**
     * Initializes the applet --- called by the browser.
     */
    public void init ()
    {
        // create container to display animations
        init(new Dimension(Integer.parseInt(getParameter("width")),
                           Integer.parseInt(getParameter("height"))));
    }


    /**
     * Initializes the applet --- called by main.
     */
    public void init (Dimension size)
    {
        // create container to display animations
        myDisplay = new Canvas();
        myDisplay.setPreferredSize(size);
        myDisplay.setSize(size);
        myDisplay.setFocusable(true);
        myDisplay.requestFocus();

        // add our user interface components to applet and show it
        getContentPane().add(myDisplay, BorderLayout.CENTER);
    }
    
    
    /**
     * Starts the applet's action, i.e., starts the animation.
     */
    public Canvas getCanvas (ArrayList<ArrayList<ArrayList<IPaintedObject>>> observations, int frameRate)
    {
        myDisplay.start(observations, frameRate);
        return myDisplay;
    }


    /**
     * Stops the applet's action, i.e., the animation.
     */
    public void stop ()
    {
    	
    }
}
